package com.imagine.service.impl;

import com.imagine.entity.BaseResult;
import com.imagine.entity.LegalPersonalSecurityAccount;
import com.imagine.entity.PersonalSecurityAccount;
import com.imagine.mapper.LegalPersonalSecurityAccountMapper;
import com.imagine.service.LegalPersonalSecurityAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

/**
 * Created by liangyue on 2017/10/18.
 */
@Service
public class LegalPersonalSecurityAccountServiceImpl implements LegalPersonalSecurityAccountService{
    @Autowired
    private LegalPersonalSecurityAccountMapper legalPersonalSecurityAccountMapper;

    @Override
    public int insertLegalPersonalSecurityAccount(LegalPersonalSecurityAccount legalPersonalSecurityAccount){
        return legalPersonalSecurityAccountMapper.insertLegalPersonalSecurityAccount(legalPersonalSecurityAccount);
    }
    @Override
    public BaseResult updatelAccountStateBylIdNumber(String lIdNumber, int state){
        BaseResult result = new BaseResult();
        HashMap<String, String> map = new HashMap<>();
        map.put("lAccountId", lIdNumber);
        map.put("newState", String.valueOf(state));
        legalPersonalSecurityAccountMapper.updatelAccountBylIdNumber(map);
        result.success("成功更改状态");
        return result;
    }
    @Override
    public LegalPersonalSecurityAccount getlAccountByLAccountId(int lAccountId){
        LegalPersonalSecurityAccount account = legalPersonalSecurityAccountMapper.getlAccountByLIdNumber(lAccountId);
        return account;
    }

    @Override
    public BaseResult getlAccountByLicense(String bussinessLicense){
        BaseResult result = new BaseResult();
        LegalPersonalSecurityAccount account = legalPersonalSecurityAccountMapper.getlAccountByLicense(bussinessLicense);
        result.success(account);
        return result;
    }
    @Override
    public BaseResult getlAccountUnchecked(){
        BaseResult result = new BaseResult();
        List<LegalPersonalSecurityAccount> list = legalPersonalSecurityAccountMapper.getlAccountUnchecked();
        result.success(list);
        return result;
    }
}
